package cn.iocoder.yudao.module.bpm.dal.mysql.formtype;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.bpm.dal.dataobject.formtype.FormTypeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.bpm.controller.admin.formtype.vo.*;

/**
 * 表单类型 Mapper
 *
 * @author admin
 */
@Mapper
public interface FormTypeMapper extends BaseMapperX<FormTypeDO> {

    default PageResult<FormTypeDO> selectPage(FormTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FormTypeDO>()
                .likeIfPresent(FormTypeDO::getName, reqVO.getName())
                .eqIfPresent(FormTypeDO::getType, reqVO.getType())
                .eqIfPresent(FormTypeDO::getStatus, reqVO.getStatus())
                .eqIfPresent(FormTypeDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(FormTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FormTypeDO::getId));
    }

    default List<FormTypeDO> selectList(FormTypeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<FormTypeDO>()
                .likeIfPresent(FormTypeDO::getName, reqVO.getName())
                .eqIfPresent(FormTypeDO::getType, reqVO.getType())
                .eqIfPresent(FormTypeDO::getStatus, reqVO.getStatus())
                .eqIfPresent(FormTypeDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(FormTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FormTypeDO::getId));
    }

}
